define('appRouter', ['vue', 'vue-router', 'iview', 'appRoutes', 'appStore'], function (
  Vue,
  VueRouter,
  iview,
  appRoutes,
  appStore
) {
  Vue.use(VueRouter)

  // console.log(iview)

  var pageRouter = new VueRouter({
    routes: appRoutes,
    mode: 'hash'
  })

  pageRouter.beforeEach((to, from, next) => {
    appStore.commit('setBreadCrumb', to.matched)
    iview.LoadingBar.start()
    next()
  })
  pageRouter.afterEach(to => {
    iview.LoadingBar.finish()
    window.scrollTo(0, 0)
  })

  return pageRouter
})
